package com.googlecode.animator.controller
{
	import com.googlecode.animator.data.markers.KeyframeVO;
	import com.googlecode.animator.utils.UniqueID;
	
	import org.puremvc.as3.interfaces.INotification;

	/**
	 * Adds KeyframeVO to an object3D within the model. 
	 * @author USER
	 * 
	 */
	public class TimelineAddKeyframeCommand extends BaseCommand
	{
		/**
		 * Generates a unique number based on the time and date. 
		 */
		private var _uniqueID:UniqueID = new UniqueID();
		
		/**
		 * Executes command. 
		 * @param notification
		 * 
		 */
		override public function execute(notification:INotification):void
		{
			var kf:KeyframeVO = notification.getBody() as KeyframeVO;
			
			if(kf.id == null)
			{
				kf.id = "keyframe_"  + _uniqueID.generateID();
			}
			
			settings.addKeyframe(kf.object3DName, kf);
			
			// at this point the tweens for the object3D will have to be recalculated	
			// sendNotification(Notifications.TIMELINE_CALCULATE_TWEENS, kf.object3DName);

		}
		
	}
}